package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetmealDishMapper {

    /**
     * 根据菜品id查询相应套餐id
     * @return
     */
    List<Long> getSetmealIdsByDishIds(List<Long> dishIds);

    /**
     * 新增套餐菜品
     * @param setmealDishes
     */
    /*@Insert("insert into setmeal_dish (setmeal_id, dish_id, name, price, copies) " +
            "VALUES" +
            "(#{setmealDishes.setmealId},#{setmealDishes.dishId},#{setmealDishes.name},#{setmealDishes.price},#{setmealDishes.copies})")*/
    void insertBatch(List<SetmealDish> setmealDishes);

    /**
     * 通过套餐id查询相应的菜品
     * @param setmealId
     * @return
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setmealId}")
    List<SetmealDish> getById(Long setmealId);

    /**
     * 根据套餐id删除对应的菜品
     * @param setmealId
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{setmealId}")
    void deleteBySetmealId(Long setmealId);

    /**
     * 根据套餐id批量删除菜品
     * @param setmealIds
     */
    void deleteBySetmealIds(List<Long> setmealIds);
}
